This page last changed on May 21, 2012 by brian.

Overview

Once the points of interest are extracted from both the GAL file and image our next goal is to align the GAL points to those on the image. The basic algorithm works as follows:

The Alignment Algorithm

The Basics

The basic building block of algorithm is a chromosome. Our chromosome encodes information that represents 3 points, where a point is an x, y pair in image pixel coordinates. Only two points are used, but the 3rd point would be useful if we ever need to run an affine transform instead of a linear transform. An individual chromosome is created as follows:

import org.mbari.esp.ia.geometry.Point2D
import org.mbari.esp.ia.ga.PointChromosome

val p0 = Point2D(10, 10)
val p1 = Point2D(20, 20)
val p2 = Point2D(30, 30)
val chromosome = PointChromosome(p0, p1, p2)

Why use a chromosome to represent the points? Originally, feature alignement was done using a genetic algorithm, but it's been refined so that we now use some considerable less complex.

The goal of our feature alignment is to find a non-rigid transform that rotates, scales and translates the gal points in euclidean space to align with point features extracted from the image. The recipe for this has several steps:

  1. Read the GAL file and extract points for a single filter
  2. Extract the fiducial points from the single fitler's gal points.
  3. Read an ESP image and extract the bright fiducial spots
  4. Read an ESP image and extract all spot features.
  5. Run through all the possible permutations of aligning the gal points to the image fiducial points
    1. Calculate the fitness for each permutation
    2. Select the fittest alignment.

The basic goal of the genetic algorithm is to take 2 points from the GAL and match them to the corresponding 2 points on the image. To achieve this we do the following:

  1. Calculate the linear transform needed to rotate, scale, and align the GAL to the image and apply this to all the points in the GAL file.
  2. Calculate a fitness for the match between the image and GAL points. This fitness is actually a mutlipart evalucation
    1. First check that all the transformed GAL points are within the bounds of the image. If they are not we evaluate this match as unfit.
    2. Second, we check that the GAL points have not collapsed by calculating the most common distance between nearest neighbors. Then we check to see that this distance less than the maximum distance between image point pairs and greater then the minimum distance between point pairs.
    3. Finally, we use a weighted distance function. This calculates
      1. the distance between all image points and all gal points.
      2. Selects the GAL point nearest each image point.
      3. Takes the distance parameter (we're using 7 pixels) and if the GAL-Image point distance is less than our distance param, we use the following
        f  = fitness
        d  = maximum distance [provided by user]
        n  = number of image points
        dn = distance from image point to nearest GAL point


fitnessfn.gif (image/gif)
Document generated by Confluence on Feb 03, 2026 14:16